//
//  MoreDanMuTableViewCell.m
//  A_Comic
//
//  Created by sos on 16/1/21.
//  Copyright © 2016年 sos. All rights reserved.
//

#import "MoreDanMuTableViewCell.h"

@implementation MoreDanMuTableViewCell
- (void)dealloc
{
    
    [_qqImage release];
    [_nameLabel release];
    [_autorLabel release];
    [_label release];
    [_pictureImage release];
    [_discussButton release];
    [_goodLikeButton release];
    [_lineView release];
    [super dealloc];
}


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.backGroundView = [[UIView alloc]init];
//        self.backGroundView.backgroundColor = [UIColor grayColor];
        [self.contentView addSubview:self.backGroundView];
        [self.backGroundView release];
        
        self.qqImage = [[UIImageView alloc]init];
//        self.qqImage.backgroundColor = [UIColor redColor];
        [self.backGroundView addSubview:self.qqImage];
        [self.qqImage release];
        
        self.nameLabel = [[UILabel alloc]init];
//        self.nameLabel.backgroundColor = [UIColor blueColor];
        [self.backGroundView addSubview:self.nameLabel];
        [self.nameLabel release];
        
        self.autorLabel = [[UILabel alloc]init];
//        self.autorLabel.backgroundColor = [UIColor yellowColor];
        [self.backGroundView addSubview:self.autorLabel];
        [self.autorLabel release];
        
        self.label = [[UILabel alloc]init];
        self.label.backgroundColor = [UIColor brownColor];
        [self.backGroundView addSubview:self.label];
        [self.label release];
        
        self.pictureImage = [[UIImageView alloc]init];
//        self.pictureImage.backgroundColor = [UIColor greenColor];
        [self.backGroundView addSubview:self.pictureImage];
        [self.pictureImage release];
        
        self.discussButton = [UIButton buttonWithType:UIButtonTypeCustom];
        self.discussButton.backgroundColor = [UIColor purpleColor];
        [self.backGroundView addSubview:self.discussButton];
        
        self.goodLikeButton = [UIButton buttonWithType:UIButtonTypeCustom];
        self.goodLikeButton.backgroundColor = [UIColor orangeColor];
        [self.backGroundView addSubview:self.goodLikeButton];
        
        
    }
    return self;
}

-(void)layoutSubviews
{
    
    [super layoutSubviews];
    
    
    self.backGroundView.frame = CGRectMake(10, 0, self.contentView.frame.size.width-20, self.contentView.frame.size.height-10);
    
    
    self.qqImage.frame = CGRectMake(0, 0, self.backGroundView.frame.size.width/10, self.backGroundView.frame.size.width/10);
    self.qqImage.layer.cornerRadius = self.backGroundView.frame.size.width/20;
    self.qqImage.clipsToBounds = YES;
    
    self.autorLabel.frame = CGRectMake(self.qqImage.frame.origin.x+self.qqImage.frame.size.width+5, self.qqImage.frame.origin.y+5, self.backGroundView.frame.size.width/3, self.qqImage.frame.size.height-5);
    
    self.nameLabel.frame = CGRectMake(self.autorLabel.frame.origin.x+self.autorLabel.frame.size.width+50, self.autorLabel.frame.origin.y, self.backGroundView.frame.size.width/3+20, self.autorLabel.frame.size.height);
    self.nameLabel.textAlignment = NSTextAlignmentRight;
    
    self.pictureImage.frame = CGRectMake(0, self.qqImage.frame.origin.y+self.qqImage.frame.size.height+10, self.backGroundView.frame.size.width, self.backGroundView.frame.size.height-self.qqImage.frame.size.height-10-50);
    
    self.discussButton.frame = CGRectMake(self.pictureImage.frame.origin.x, self.pictureImage.frame.origin.y+self.pictureImage.frame.size.height, self.backGroundView.frame.size.width/2-10, self.backGroundView.frame.size.height-self.pictureImage.frame.origin.y-self.pictureImage.frame.size.height);
    
    self.discussButton.center = CGPointMake(self.backGroundView.center.x,self.pictureImage.frame.origin.y+self.pictureImage.frame.size.height+self.discussButton.frame.size.height/2);
    
    
    
    
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
